import matplotlib.pyplot as plt
import cv2


def show_two_imgs(src1, title1, src2, title2):
    '该方法用于展示图像'
    ax1 = plt.subplot(121)
    ax1.set_title(title1)
    plt.imshow(src1)
    plt.xticks([])
    plt.yticks([])

    ax1 = plt.subplot(122)
    ax1.set_title(title2)
    plt.imshow(src2)
    plt.xticks([])
    plt.yticks([])
    plt.show()


def get_rgb_img(file_name):
    src = cv2.imread(file_name)
    # imread读图片读进来是BGR模式，所以要转化一下
    src = cv2.cvtColor(src, cv2.COLOR_BGR2RGB)
    return src
